package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2021-01-29
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_customer_bank")
@ApiModel(value = "CustomerBank", description = "")
@AllArgsConstructor
public class CustomerBank extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @NotNull(message = "不能为空")
    @TableField("customer_id")
    @Excel(name = "")
    private Long customerId;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "bank_name", condition = LIKE)
    @Excel(name = "")
    private String bankName;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 50, message = "长度不能超过50")
    @TableField(value = "bank_num", condition = LIKE)
    @Excel(name = "")
    private String bankNum;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 20, message = "长度不能超过20")
    @TableField(value = "account_name", condition = LIKE)
    @Excel(name = "")
    private String accountName;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 11, message = "长度不能超过11")
    @TableField(value = "mobile", condition = LIKE)
    @Excel(name = "")
    private String mobile;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 18, message = "长度不能超过18")
    @TableField(value = "id_card", condition = LIKE)
    @Excel(name = "")
    private String idCard;

    /**
     * 开户支行
     */
    @ApiModelProperty(value = "开户支行")
    @Length(max = 100, message = "开户支行长度不能超过100")
    @TableField(value = "bank_branch", condition = LIKE)
    @Excel(name = "开户支行")
    private String bankBranch;

    /**
     * 卡类型
     */
    @ApiModelProperty(value = "卡类型")
    @TableField("card_type")
    @Excel(name = "卡类型")
    private Integer cardType;

    /**
     * cvv
     */
    @ApiModelProperty(value = "cvv")
    @Length(max = 20, message = "cvv长度不能超过20")
    @TableField(value = "cvv", condition = LIKE)
    @Excel(name = "cvv")
    private String cvv;

    /**
     * 有效期
     */
    @ApiModelProperty(value = "有效期")
    @Length(max = 20, message = "有效期长度不能超过20")
    @TableField(value = "expdate", condition = LIKE)
    @Excel(name = "有效期")
    private String expdate;
    /**
     * 银行简称
     */
    @ApiModelProperty(value = "银行简称")
    @Length(max = 20, message = "银行简称长度不能超过20")
    @TableField(value = "bank_abbr")
    @Excel(name = "有效期")
    private String bankAbbr;
    /**
     * 有效期
     */
    @ApiModelProperty(value = "是否默认结算卡")
    @Length(max = 20, message = "是否默认结算卡")
    @TableField(value = "is_default")
    @Excel(name = "是否默认结算卡")
    private Integer isDefault;

    @TableField(exist = false)
    private Long feeRate;
    @TableField(exist = false)
    private Long externFee;


    @Builder
    public CustomerBank(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    Long customerId, String bankName, String bankNum, String accountName, String mobile, 
                    String idCard, String bankBranch, Integer cardType, String cvv, String expdate, Integer isDefault) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.customerId = customerId;
        this.bankName = bankName;
        this.bankNum = bankNum;
        this.accountName = accountName;
        this.mobile = mobile;
        this.idCard = idCard;
        this.bankBranch = bankBranch;
        this.cardType = cardType;
        this.cvv = cvv;
        this.expdate = expdate;
        this.isDefault = isDefault;
    }

}
